<!DOCTYPE html>
<html lang="en">
{% include 'head.html' %}
<body>
	{% include 'navbar.html' %}
	{% include 'header.html' %}
	
	{% if movies or unranked_movies %}
		<div class="row">
			<div id="dhtmlgoodies_dragDropContainer">
				<div id="dhtmlgoodies_listOfItems">	
					<ul id="allItems">
						{% for movie in movies %}
							<li id="{{movie.id}}">{{forloop.counter}}. {{movie.Title}} ({{movie.Year}})</li>
						{% endfor %}
						{% for movie in unranked_movies %}
							<li id="u{{movie.id}}">Unranked: {{movie.Title}} ({{movie.Year}})</li>
						{% endfor %}
					</ul>
				</div>	
			</div>
			<ul id="dragContent"></ul>
			<div id="dragDropIndicator"><img src="{{STATIC_URL}}img/insert.gif"></div>
		</div>
		<div class="row">
			<div class="span1 offset1">
				<a class="btn btn-large btn-success" href="#" onclick="saveArrangableNodes();return false">Save</a>
				{% url movies.views.view_profile username=profile.Username as profile_url %}
				<form id="rankForm" action="{{profile_url}}?rank=1" method="post"> {% csrf_token %}
					<input type="hidden" id="hiddenMovieIds" name="hiddenMovieIds">
				</form>
			</div>
			<div class="span2">
				{% url movies.views.view_profile username=profile.Username as profile_url %}
				<a class="btn btn-large btn-success" href="{{profile_url}}?movies=1">Full Listings</a>
			</div>
		</div>
	{% else %}
		{% url movies.views.discovery as discovery_url %}
		<big>No movies ranked. You should <a href="{{discovery_url}}">Find Movies</a> to populate this page.</big>
	{% endif %}

	{% include 'footer.html' %}
</body>
</html>